function newPos = shipStandStill(graph, currentPos, lastPos, p,s)
%% Funktion gives the new position of the ship using the optimal-ferguson
%% strategy with the additonal fact that the ship can also stand sill

%find the possible next positions
possible = [];
for i=1:length(graph)
    if(i~=lastPos(1) && graph(currentPos,i) == 1 && i~=currentPos) % also exclude the current place, because it has its own probability
        possible = [possible, i];
    end
end

%calculate the next postion
if(lastPos(1) <=0) % very first move: Ship has to move
    newPos = possible(ceil(rand(1)*length(possible)));
else
    random = rand(1);
    newPos = lastPos(1); % first initialisation: go backwards
    for i=1:length(possible)
        if(random<i*p)
            newPos = possible(i); % going forwards
            break;
        end
    end
    if(newPos==lastPos(1) && random<(length(possible)*p+s))
       newPos=currentPos;  % stand still
    end
end
